package com.longrise.android.byjk.plugins.course.coursedetail.healthrisk;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.longrise.android.byjk.plugins.course.coursedetail.healthrisk.catalogue.HealthRiskCatalogueFragment;
import com.longrise.android.byjk.plugins.course.coursedetail.healthrisk.intro.HealthRiskIntroFragment;

/**
 * Created by callxkj on 2018/1/14.
 * 风险管理师  介绍 目录
 */

public class HealthRiskPagerAdapter extends FragmentPagerAdapter {
    private final HealthRiskIntroFragment mHealthRiskIntroFragment;
    private final HealthRiskCatalogueFragment mHealthRiskCatalogueFragment;

    //private final String mCourseId;

    public HealthRiskPagerAdapter(FragmentManager fragmentManager, HealthRiskIntroFragment healthRiskIntroFragment,
                                  HealthRiskCatalogueFragment healthRiskCatalogueFragment) {
        super(fragmentManager);
        //this.mCourseId = courseid;
        this.mHealthRiskIntroFragment = healthRiskIntroFragment;
        this.mHealthRiskCatalogueFragment = healthRiskCatalogueFragment;
    }

    @Override
    public Fragment getItem(int position) {
        if (position == 0) {
            return mHealthRiskIntroFragment;
            //return HealthRiskIntroFragment.getInstance(mCourseId);
        } else {
            return mHealthRiskCatalogueFragment;
            //return HealthRiskCatalogueFragment.getInstance(mCourseId);
        }
    }

    @Override
    public int getCount() {
        return 2;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        if (position == 0) {
            return "介绍";
        } else {
            return "目录";
        }
    }
}
